<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
| 路由文件 
|
*/

//主页
Route::get('/', function () {

    return view('welcome');
});

//上传文件
Route::post('/', 'FileController@upload');

//
//Route::post('/askCode','FileController@askCode');

//获取题目
Route::post('/getQs','QuestionsController@getQuestions');

//回答问题
Route::post('/answer','ExamController@answerFromStu');

//统计
Route::post('/statistic','QuestionsController@statisticResult');

//开始答题
Route::post('/startAnswer','ExamController@startAnswer');

//下载文件
Route::get('/save','FileController@saveWithXlsx');

//验证学生信息
Route::post('/vaildInfo','ExamController@vaildStuInfo');

//获取当前题目
Route::post('/getnow','QuestionsController@nowQuestions');

//修改答题模式
Route::post('/changeMode','QuestionsController@setAskMode');

Route::get('testmid',[
    'middleware' => 'cors',
    'uses'=>'CompareController@testMiddle'
]);


Route::post('/getdata',"PiController@getData");
Route::post('/showdata',"PiController@showData");

//
Route::get('compare','CompareController@testCache');

Route::get('/user','UserController@register');

Route::get('profile', [
    'middleware' => 'cors',
    'uses' => 'CompareController@testMiddle'
]);

//Route::get('/', ['middleware' => 'auth.basic.once', function() {
//
//    return view('welcome');
//}]);

Route::get('/lout', 'UserController@logout');
//
//Route::get('profile', ['middleware' => 'auth.basic', function() {
//    return "Success";
//}]);
//
//Route::post('authme', 'UserController@authenticate');
//
//Route::get('update', 'UserController@updateProfile');
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/

Route::group(['middleware' => ['web']], function () {
    //
});

Route::group(['middleware' => 'web'], function () {
    Route::auth();

    Route::get('/home', 'HomeController@index');
});
